// Copyright 2008 Senary
// See credits.txt for details.

// This file is part of Omega VII.

// Omega VII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Omega VII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Omega VII.  If not, see <http://www.gnu.org/licenses/>.

#include "Button.h"

using namespace std;

Button::Button(pair<int, int> position, int layer, string imageName)
	: ImagePanel(position, layer, imageName)
{
}

Button::~Button(void)
{
}
	
//add observer
void Button::addObserver(ButtonObserver* observer)
{
	//add observer
	_observers.push_back(observer);
}

// gets called by InputManager if a mouseclick occurred
void Button::mouseClicked(std::pair<int, int> position)
{
	std::vector<ButtonObserver*>::iterator it;
	//inform all observers of the event
	for(it=_observers.begin();it!=_observers.end();it++) {
		(*it)->on_clicked(this);
	}
}

string const& Button::getToolTipText() const
{
	return _toolTipText;
}

void Button::setToolTipText(const std::string &text) 
{
	_toolTipText = text;
}